<?PHP $this->_extends('_layouts/manager_layout');?>
<?PHP $this->_block('head');?>
<?PHP $this->_endblock();?>
<?PHP $this->_block('contents');?>
<table style="border:1px solid #c0c0c0">
	<tr>
		<td colspan=4 style="border-bottom:1px solid #c0c0c0"><b><a href="<?=url("/mailtemplateedit")?>">添加邮件模板</a></b></td>
	</tr>
	<?php foreach(Store_Mailtemplate::$arrayUseforcode as $code=>$value){
		$E=Store_Mailtemplate::find("[useforcode]=? and [store_id]=?",$code,$store["store_id"])->getOne();?>
		<tr>
			<td style="border-bottom:1px solid #c0c0c0;width:250px;"><font color='#f00'>(系统邮件)</font> <?php echo $value?></td>
			<?php if ($E->isNewRecord()){?>
				<td style="border-bottom:1px solid #c0c0c0"><font color='#f00'>还未开通</font></td>
				<td style="border-bottom:1px solid #c0c0c0"><a href="<?=url("/mailtemplateedit",array("usefor"=>urlencode($value),"useforcode"=>$code))?>">开通邮件</a></td>
			<?php }else{?>
				<td style="border-bottom:1px solid #c0c0c0"><?php echo htmlspecialchars($E->title)?></td>
				<td style="border-bottom:1px solid #c0c0c0"><a href="<?=url("/mailtemplateedit",array("mailtemplate_id"=>$E->mailtemplate_id))?>">查看修改</a></td>			
			<?php }?>
			<td style="border-bottom:1px solid #c0c0c0">-</td>
		</tr>
	<?php }?>
	<?php foreach($Mailtemplate as $E):?>
		<tr>
			<td style="border-bottom:1px solid #c0c0c0"><?php echo htmlspecialchars($E->usefor)?></td>
			<td style="border-bottom:1px solid #c0c0c0"><?php echo htmlspecialchars($E->title)?></td>
			<td style="border-bottom:1px solid #c0c0c0"><a href="<?=url("/mailtemplateedit",array("mailtemplate_id"=>$E->mailtemplate_id))?>">查看修改</a></td>
			<td style="border-bottom:1px solid #c0c0c0"><a href="<?=url("/mailtemplatedelete",array("mailtemplate_id"=>$E->mailtemplate_id))?>" onclick="return confirm('确认删除?')">删除</a></td>
		</tr>
	<?php endforeach;?>
</table>
<?php if(!empty($page)){ $this->_control('pagination2','collection-list',array('pagination'=>$page));} ?>

<?php $this->_endblock();?>